package com.carpedil.redis.queue;

import java.util.concurrent.ArrayBlockingQueue;

/** @author Administrator */
public class OutThread extends Thread {
  ArrayBlockingQueue<String> queue = null;

  public OutThread(ArrayBlockingQueue<String> queue) {
    this.queue = queue;
  }

  @Override
  public void run() {
    while (true) {
      try {
        String item = queue.take();
        System.out.println(
            "-----------------> "
                + Thread.currentThread().getName()
                + "取出: "
                + item
                + ", 剩余馒头: "
                + queue.size());
        Thread.sleep(1000 * 1);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
}
